package com.extension.company.view.home;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.extension.company.admin.R;
import com.extension.company.common.mvp.BaseTitleActivity;
import com.extension.company.contract.home.CityNeedContract;
import com.extension.company.model.entity.CityNeedData;
import com.extension.company.presenter.home.CityNeedPresenter;
import com.extension.company.view.adapter.CityNeedAdapter;
import com.extension.company.view.adapter.OnRecyclerViewClickListener;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class CityNeedActivity extends BaseTitleActivity<CityNeedContract.View, CityNeedPresenter> implements CityNeedContract.View {

	@BindView(R.id.needcity_rv)
	RecyclerView recyclerView;

	private List<CityNeedData> list;
	private CityNeedAdapter cityNeedAdapter;


	public static void startCityNeedActivity(Context context) {
		Intent intent = new Intent(context, CityNeedActivity.class);
		context.startActivity(intent);
	}

	@Override
	protected void initData() {
		setTitle("同城发布需求");

		list = new ArrayList<>();
		CityNeedData cityNeedData1 = new CityNeedData();
		cityNeedData1.setImgPath(R.drawable.cityneed_house_service);
		cityNeedData1.setImgName("家政服务");

		CityNeedData cityNeedData2 = new CityNeedData();
		cityNeedData2.setImgPath(R.drawable.cityneed_decoration);
		cityNeedData2.setImgName("装修建材");

		CityNeedData cityNeedData3 = new CityNeedData();
		cityNeedData3.setImgPath(R.drawable.cityneed_edu);
		cityNeedData3.setImgName("教育培训");

		CityNeedData cityNeedData4 = new CityNeedData();
		cityNeedData4.setImgPath(R.drawable.cityneed_business);
		cityNeedData4.setImgName("商务服务");

		CityNeedData cityNeedData5 = new CityNeedData();
		cityNeedData5.setImgPath(R.drawable.cityneed_pets);
		cityNeedData5.setImgName("宠物服务");

		CityNeedData cityNeedData6 = new CityNeedData();
		cityNeedData6.setImgPath(R.drawable.cityneed_entertainment);
		cityNeedData6.setImgName("休闲娱乐");

		CityNeedData cityNeedData7 = new CityNeedData();
		cityNeedData7.setImgPath(R.drawable.cityneed_wedding_celebration);
		cityNeedData7.setImgName("婚庆服务");

		CityNeedData cityNeedData8 = new CityNeedData();
		cityNeedData8.setImgPath(R.drawable.cityneed_eat);
		cityNeedData8.setImgName("餐饮服务");

		CityNeedData cityNeedData9 = new CityNeedData();
		cityNeedData9.setImgPath(R.drawable.cityneed_car);
		cityNeedData9.setImgName("汽车服务");

		CityNeedData cityNeedData10 = new CityNeedData();
		cityNeedData10.setImgPath(R.drawable.cityneed_hotel);
		cityNeedData10.setImgName("旅游酒店");

		CityNeedData cityNeedData11 = new CityNeedData();
		cityNeedData11.setImgPath(R.drawable.cityneed_purchase);
		cityNeedData11.setImgName("批发采购");

		list.add(cityNeedData1);
		list.add(cityNeedData2);
		list.add(cityNeedData3);
		list.add(cityNeedData4);
		list.add(cityNeedData5);
		list.add(cityNeedData6);
		list.add(cityNeedData7);
		list.add(cityNeedData8);
		list.add(cityNeedData9);
		list.add(cityNeedData10);
		list.add(cityNeedData11);

		cityNeedAdapter = new CityNeedAdapter(this, list);
		recyclerView.setAdapter(cityNeedAdapter);
		cityNeedAdapter.setContent(list);

	}

	@Override
	protected void initListener() {
		cityNeedAdapter.setOnClickListener(new OnRecyclerViewClickListener() {
			@Override
			public void onItemClick(View view, int position) {
				DemandReleaseActivity.startActivity(CityNeedActivity.this);
			}

			@Override
			public void onItemLongClick(View view, int position) {

			}
		});

	}

	@Override
	public int getMainLayout() {
		return R.layout.activity_city_need;
	}

	@Override
	public CityNeedContract.View createView() {
		return this;
	}

	@Override
	public CityNeedPresenter createPresenter() {
		return new CityNeedPresenter();
	}

	@Override
	public void showLoading() {

	}

	@Override
	public void hideLoading() {

	}

	@Override
	public void onError(Throwable throwable) {

	}

}
